MDEV-37442 Fix collation error in mariadb-dump --system=user#4549
MDEV-37442 Fix collation error in mariadb-dump --system=user#4549MooSayed1 wants to merge 1 commit intoMariaDB:mainfrom
Conversation
b4849b5 to
06986fa
Compare
gkodinov
left a comment
There was a problem hiding this comment.
This is a preliminary review.
First of all, please follow the https://github.com/MariaDB/server/blob/main/CODING_STANDARDS.md#git-commit-messages for the format of the commit message.
Secondly: this needs a test case according to https://mariadb.com/docs/general-resources/community/contributing-participating/contributing-code#testing. A basic rule of thumb is that the test added should fail without the fix and succeed with it.
Also, this definitely can benefit from a better explanation.
The root cause is that, when MySQL role tables are present, these tables are most probably using a collation that is not compatible with the collation after the mariaDB upgrade. And, since these tables are not present in a new database, there's no issue with this.
Note that this is not the only place to fix this. role_edges is used in many other places too. I'd review all of these, make sure they're executed, and try to fix all of them as well.
And, I believe that for this particular fix to make any difference, you also need to be running a MySQL server for this line to actually kick in. I've tried it on the command line as it is against a recent mariadbd and the role_edges didn't get into the explain at all!
I would ask the reporter what is their exact setup: are they getting this while running their "script" that they mention against a MySQL server binary (which I guess they do, since this particular conditional join seems to be kicking in according to the error message). And what tables do they have in their database (SHOW CREATE TABLE would be nice). It's good to confirm this. Especially if you are trying to make a test case for it.
|
@gkodinov Thank you for the review feedback. I’ve asked the reporter on JIRA for clarification about their setup, specifically: Whether they’re running against MySQL or MariaDB server Review all role_edges usages in the codebase |
The JOIN between
mysql.userandmysql.role_edgesfails when tableshave different collations after upgrade (old tables keep utf8mb4_general_ci,
new default is utf8mb4_uca1400_ai_ci).
Solution
Add explicit
COLLATE utf8mb4_general_cito the JOIN conditions to ensureconsistent collation comparison regardless of upgrade path.